﻿using System;
using System.Collections.Generic;
using KKSG;
using UnityEngine;
using XMainClient.Tutorial.Command;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000DFB RID: 3579
	internal class XTutorialCmdExecutor
	{
		// Token: 0x0600C16A RID: 49514 RVA: 0x00293260 File Offset: 0x00291460
		public void ExecuteCmd(ref XTutorialCmd Cmd)
		{
			this.ResetRelativeFlag();
			bool flag = this.IsSkip(Cmd);
			if (flag)
			{
				bool flag2 = Cmd.skipParam1 != null && int.Parse(Cmd.skipParam1) != 0;
				if (flag2)
				{
					XSingleton<XTutorialMgr>.singleton.SkipCurrentTutorial(false);
				}
				else
				{
					Cmd.state = XCmdState.Cmd_Finished;
					XSingleton<XDebug>.singleton.AddLog("Skip Tutorial:" + Cmd.tag, null, null, null, null, null, XDebugColor.XDebug_None);
				}
			}
			else
			{
				bool flag3 = Cmd.cmd == "forceclick";
				if (flag3)
				{
					this._command = this._forceCmd;
					this._command.SetCommand(Cmd);
					bool flag4 = this._command.Execute();
					if (flag4)
					{
						Cmd.state = XCmdState.Cmd_In_Process;
					}
				}
				else
				{
					bool flag5 = Cmd.cmd == "forceskill";
					if (flag5)
					{
						this._command = this._skillCmd;
						this._command.SetCommand(Cmd);
						bool flag6 = this._command.Execute();
						if (flag6)
						{
							Cmd.state = XCmdState.Cmd_In_Process;
						}
					}
					else
					{
						bool flag7 = Cmd.cmd == "noforceclick";
						if (flag7)
						{
							this._command = this._noforceClickCmd;
							this._command.SetCommand(Cmd);
							bool flag8 = this._command.Execute();
							if (flag8)
							{
								Cmd.state = XCmdState.Cmd_In_Process;
							}
						}
						else
						{
							bool flag9 = Cmd.cmd == "forceslide";
							if (flag9)
							{
								this._command = this._forceSlideCmd;
								this._command.SetCommand(Cmd);
								bool flag10 = this._command.Execute();
								if (flag10)
								{
									Cmd.state = XCmdState.Cmd_In_Process;
								}
							}
							else
							{
								bool flag11 = Cmd.cmd == "movetutorial";
								if (flag11)
								{
									this._command = this._moveCmd;
									this._command.SetCommand(Cmd);
									bool flag12 = this._command.Execute();
									if (flag12)
									{
										Cmd.state = XCmdState.Cmd_In_Process;
									}
								}
								else
								{
									bool flag13 = Cmd.cmd == "newsys";
									if (flag13)
									{
										this._command = this._newIconCmd;
										this._command.SetCommand(Cmd);
										bool flag14 = this._command.Execute();
										if (flag14)
										{
											Cmd.state = XCmdState.Cmd_In_Process;
										}
									}
									else
									{
										bool flag15 = Cmd.cmd == "directsys";
										if (flag15)
										{
											this._command = this._newDirectSys;
											this._command.SetCommand(Cmd);
											bool flag16 = this._command.Execute();
											if (flag16)
											{
												Cmd.state = XCmdState.Cmd_In_Process;
											}
											XSingleton<XTutorialMgr>.singleton.OnCmdFinished();
										}
										else
										{
											bool flag17 = Cmd.cmd == "clickentity";
											if (flag17)
											{
												this._command = this._clickEntityCmd;
												this._command.SetCommand(Cmd);
												bool flag18 = this._command.Execute();
												if (flag18)
												{
													Cmd.state = XCmdState.Cmd_In_Process;
												}
											}
											else
											{
												bool flag19 = Cmd.cmd == "cutscene";
												if (flag19)
												{
													this._command = this._cutsceneCmd;
													this._command.SetCommand(Cmd);
													bool flag20 = this._command.Execute();
													if (flag20)
													{
														Cmd.state = XCmdState.Cmd_In_Process;
													}
												}
												else
												{
													bool flag21 = Cmd.cmd == "exec";
													if (flag21)
													{
														this._command = this._execCmd;
														this._command.SetCommand(Cmd);
														bool flag22 = this._command.Execute();
														if (flag22)
														{
															Cmd.state = XCmdState.Cmd_Finished;
														}
													}
													else
													{
														bool flag23 = Cmd.cmd == "puretext";
														if (flag23)
														{
															this._command = this._pureTextCmd;
															this._command.SetCommand(Cmd);
															bool flag24 = this._command.Execute();
															if (flag24)
															{
																Cmd.state = XCmdState.Cmd_In_Process;
															}
														}
														else
														{
															bool flag25 = Cmd.cmd == "overlay";
															if (flag25)
															{
																this._command = this._overlayCmd;
																this._command.SetCommand(Cmd);
																bool flag26 = this._command.Execute();
																if (flag26)
																{
																	Cmd.state = XCmdState.Cmd_In_Process;
																}
															}
															else
															{
																bool flag27 = Cmd.cmd == "genericclick";
																if (flag27)
																{
																	this._command = this._genericClickCmd;
																	this._command.SetCommand(Cmd);
																	bool flag28 = this._command.Execute();
																	if (flag28)
																	{
																		Cmd.state = XCmdState.Cmd_In_Process;
																	}
																}
																else
																{
																	bool flag29 = Cmd.cmd == "showprefab";
																	if (flag29)
																	{
																		this._command = this._prefabCmd;
																		this._command.SetCommand(Cmd);
																		bool flag30 = this._command.Execute();
																		if (flag30)
																		{
																			Cmd.state = XCmdState.Cmd_In_Process;
																		}
																	}
																	else
																	{
																		bool flag31 = Cmd.cmd == "notewindow";
																		if (flag31)
																		{
																			this._command = this._noteCmd;
																			this._command.SetCommand(Cmd);
																			bool flag32 = this._command.Execute();
																			if (flag32)
																			{
																				Cmd.state = XCmdState.Cmd_In_Process;
																			}
																		}
																		else
																		{
																			bool flag33 = Cmd.cmd == "hideskills";
																			if (flag33)
																			{
																				this._command = this._hideskillCmd;
																				this._command.SetCommand(Cmd);
																				bool flag34 = this._command.Execute();
																				if (flag34)
																				{
																					Cmd.state = XCmdState.Cmd_Finished;
																				}
																			}
																			else
																			{
																				bool flag35 = Cmd.cmd == "showskills";
																				if (flag35)
																				{
																					this._command = this._showskillCmd;
																					this._command.SetCommand(Cmd);
																					bool flag36 = this._command.Execute();
																					if (flag36)
																					{
																						Cmd.state = XCmdState.Cmd_Finished;
																					}
																				}
																				else
																				{
																					bool flag37 = Cmd.cmd == "showbutton";
																					if (flag37)
																					{
																						this._command = this._isshowbuttonCmd;
																						this._command.SetCommand(Cmd);
																						bool flag38 = this._command.Execute();
																						if (flag38)
																						{
																							Cmd.state = XCmdState.Cmd_Finished;
																						}
																					}
																					else
																					{
																						bool flag39 = Cmd.cmd == "empty";
																						if (flag39)
																						{
																							this._command = this._emptyCmd;
																							this._command.SetCommand(Cmd);
																							bool flag40 = this._command.Execute();
																							if (flag40)
																							{
																								Cmd.state = XCmdState.Cmd_In_Process;
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x0600C16B RID: 49515 RVA: 0x002938E8 File Offset: 0x00291AE8
		public void UpdateCmd(ref XTutorialCmd Cmd)
		{
			this._command.Update();
			bool flag = this.CanCmdFinish(Cmd);
			if (flag)
			{
				XSingleton<XTutorialMgr>.singleton.OnCmdFinished();
			}
		}

		// Token: 0x0600C16C RID: 49516 RVA: 0x0029391B File Offset: 0x00291B1B
		public void StopCmd()
		{
			this._command.Stop();
		}

		// Token: 0x0600C16D RID: 49517 RVA: 0x0029392A File Offset: 0x00291B2A
		public void OnCmdFinish(ref XTutorialCmd Cmd)
		{
			this._command.OnFinish();
			Cmd.state = XCmdState.Cmd_Finished;
			this._lastCmdFinishTime = Time.time;
		}

		// Token: 0x0600C16E RID: 49518 RVA: 0x0029394C File Offset: 0x00291B4C
		private bool ConditionSatisified(List<XTutorialCmdExecuteCondition> conds, List<string> param)
		{
			bool flag = true;
			for (int i = 0; i < conds.Count; i++)
			{
				switch (conds[i])
				{
				case XTutorialCmdExecuteCondition.Player_Level:
				{
					bool flag2 = (ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)int.Parse(param[i]));
					if (flag2)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.In_Level:
				{
					uint sceneID = XSingleton<XScene>.singleton.SceneID;
					bool flag3 = sceneID != (uint)int.Parse(param[i]);
					if (flag3)
					{
						flag = false;
					}
					else
					{
						bool flag4 = sceneID == 1U;
						if (flag4)
						{
							bool flag5 = !DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
							if (flag5)
							{
								flag = false;
							}
						}
					}
					break;
				}
				case XTutorialCmdExecuteCondition.After_Level:
				{
					uint lastFinishScene = XSingleton<XLevelFinishMgr>.singleton.LastFinishScene;
					bool flag6 = lastFinishScene != (uint)int.Parse(param[i]);
					if (flag6)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Cast_Skill:
				{
					bool flag7 = XSingleton<XEntityMgr>.singleton.Boss == null || !XSingleton<XEntityMgr>.singleton.Boss.Skill.IsCasting() || XSingleton<XEntityMgr>.singleton.Boss.Skill.CurrentSkill.MainCore.ID != XSingleton<XCommon>.singleton.XHash(param[i]);
					if (flag7)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.External_String:
				{
					bool flag8 = !XSingleton<XTutorialMgr>.singleton.QueryExternalString(param[i], false);
					if (flag8)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Talk_Npc:
				{
					bool flag9 = !DlgBase<DramaDlg, DramaDlgBehaviour>.singleton.IsVisible();
					if (flag9)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Can_Accept_Task:
				{
					XTaskDocument specificDocument = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
					int num = int.Parse(param[i]);
					bool flag10 = false;
					for (int j = 0; j < specificDocument.TaskRecord.Tasks.Count; j++)
					{
						XTaskInfo xtaskInfo = specificDocument.TaskRecord.Tasks[j];
						bool flag11 = xtaskInfo != null && (ulong)xtaskInfo.ID == (ulong)((long)num);
						if (flag11)
						{
							flag10 = true;
							bool flag12 = xtaskInfo.Status != TaskStatus.TaskStatus_CanTake || !DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
							if (flag12)
							{
								flag = false;
							}
							break;
						}
					}
					bool flag13 = !flag10;
					if (flag13)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Can_Finish_Task:
				case XTutorialCmdExecuteCondition.Task_Scene_Finish:
				{
					XTaskDocument specificDocument2 = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
					int num2 = int.Parse(param[i]);
					bool flag14 = false;
					for (int k = 0; k < specificDocument2.TaskRecord.Tasks.Count; k++)
					{
						XTaskInfo xtaskInfo2 = specificDocument2.TaskRecord.Tasks[k];
						bool flag15 = xtaskInfo2 != null && (ulong)xtaskInfo2.ID == (ulong)((long)num2);
						if (flag15)
						{
							flag14 = true;
							bool flag16 = xtaskInfo2.Status != TaskStatus.TaskStatus_Finish || !DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
							if (flag16)
							{
								flag = false;
							}
							break;
						}
					}
					bool flag17 = !flag14;
					if (flag17)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Task_Over:
				{
					XTaskDocument specificDocument3 = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
					uint taskid = uint.Parse(param[i]);
					flag = specificDocument3.TaskRecord.IsTaskFinished(taskid);
					break;
				}
				case XTutorialCmdExecuteCondition.Task_Battle:
				{
					XTaskDocument specificDocument4 = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
					uint num3 = uint.Parse(param[i]);
					bool flag18 = false;
					for (int l = 0; l < specificDocument4.TaskRecord.Tasks.Count; l++)
					{
						XTaskInfo xtaskInfo3 = specificDocument4.TaskRecord.Tasks[l];
						TaskTableNew.RowData tableData = xtaskInfo3.TableData;
						uint sceneID2 = XTaskDocument.GetSceneID(ref tableData.PassScene);
						uint sceneID3 = XTaskDocument.GetSceneID(ref tableData.TaskScene);
						bool flag19 = xtaskInfo3 != null && (sceneID2 == num3 || sceneID3 == num3);
						if (flag19)
						{
							flag18 = true;
							bool flag20 = xtaskInfo3.Status != TaskStatus.TaskStatus_Taked || !DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
							if (flag20)
							{
								flag = false;
							}
							break;
						}
					}
					bool flag21 = !flag18;
					if (flag21)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Time_Delay:
				{
					float num4 = float.Parse(param[i]);
					bool flag22 = num4 > 0f && Time.time - this._lastCmdFinishTime < num4;
					if (flag22)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Sys_Notify:
				{
					bool flag23 = flag;
					bool flag24 = !XSingleton<XTutorialMgr>.singleton.QueryExternalString("OpenSys" + param[i], false);
					if (flag24)
					{
						flag = false;
					}
					XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
					bool flag25 = xplayerData.IsSystemOpened(uint.Parse(param[i]));
					if (flag25)
					{
						flag = flag23;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Meet_Enemy:
				{
					bool flag26 = !XSingleton<XTutorialHelper>.singleton.MeetEnemy;
					if (flag26)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Art_Skill:
				{
					bool flag27 = !XSingleton<XTutorialHelper>.singleton.ArtSkillOver;
					if (flag27)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Cutscene_Over:
				{
					bool isPlaying = XSingleton<XCutScene>.singleton.IsPlaying;
					if (isPlaying)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Get_Focused:
				{
					bool flag28 = XSingleton<XEntityMgr>.singleton.Boss == null || !XSingleton<XEntityMgr>.singleton.Boss.Skill.IsCasting();
					if (flag28)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.No_SuperAmor:
				{
					XBoss boss = XSingleton<XEntityMgr>.singleton.Boss;
					bool flag29 = boss == null;
					if (flag29)
					{
						flag = false;
					}
					else
					{
						List<XBattleEnemyInfo> enemyList = DlgBase<BattleMain, BattleMainBehaviour>.singleton.EnemyInfoHandler.EnemyList;
						double num5 = 0.0;
						bool flag30 = enemyList.Count > 0;
						if (flag30)
						{
							num5 = (double)enemyList[0].m_uiSuperArmor.value;
						}
						bool flag31 = num5 > 0.0;
						if (flag31)
						{
							flag = false;
						}
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Boss_Exist:
				{
					bool flag32 = !XSingleton<XTutorialHelper>.singleton.HasBoss;
					if (flag32)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Enemy_OnGround:
				{
					bool flag33 = !XSingleton<XTutorialHelper>.singleton.HitDownOnGround;
					if (flag33)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.No_Promote:
				{
					bool flag34 = XSingleton<XEntityMgr>.singleton.Player.TypeID >= 10U;
					if (flag34)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Team2:
				{
					XTeamDocument specificDocument5 = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
					bool flag35 = !specificDocument5.bInTeam || specificDocument5.MyTeam.members.Count <= 1;
					if (flag35)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Has_Target:
				{
					bool flag36 = !XSingleton<XTutorialHelper>.singleton.HasTarget;
					if (flag36)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.MainUI:
				{
					bool flag37 = XSingleton<UIManager>.singleton.IsUIShowed() || XSingleton<UIManager>.singleton.IsHideTutorial();
					if (flag37)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Has_Item:
				{
					string[] array = param[i].Split(XGlobalConfig.SequenceSeparator);
					int num6 = int.Parse(array[0]);
					int num7 = int.Parse(array[1]);
					num6 = XBagDocument.ConvertTemplate(num6);
					XBagDocument specificDocument6 = XDocuments.GetSpecificDocument<XBagDocument>(XBagDocument.uuID);
					int num8 = (int)specificDocument6.GetItemCount(num6);
					XFashionDocument specificDocument7 = XDocuments.GetSpecificDocument<XFashionDocument>(XFashionDocument.uuID);
					bool flag38 = specificDocument7.OwnFashion(num6);
					if (flag38)
					{
						num8++;
					}
					bool flag39 = num8 < num7;
					if (flag39)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Has_Body:
				{
					XBagDocument specificDocument8 = XDocuments.GetSpecificDocument<XBagDocument>(XBagDocument.uuID);
					XItem xitem = null;
					string[] array2 = param[i].Split(XGlobalConfig.SequenceSeparator);
					string a = array2[0];
					int num9 = 0;
					bool flag40 = array2.Length > 1;
					if (flag40)
					{
						num9 = int.Parse(array2[1]);
					}
					XJadeDocument specificDocument9 = XDocuments.GetSpecificDocument<XJadeDocument>(XJadeDocument.uuID);
					int num10 = 0;
					bool flag41 = a == "boots";
					if (flag41)
					{
						num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Boots);
						xitem = specificDocument8.EquipBag[num10];
					}
					else
					{
						bool flag42 = a == "earrings";
						if (flag42)
						{
							num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Earrings);
							xitem = specificDocument8.EquipBag[num10];
						}
						else
						{
							bool flag43 = a == "gloves";
							if (flag43)
							{
								num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Gloves);
								xitem = specificDocument8.EquipBag[num10];
							}
							else
							{
								bool flag44 = a == "headgear";
								if (flag44)
								{
									num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_START);
									xitem = specificDocument8.EquipBag[num10];
								}
								else
								{
									bool flag45 = a == "lowerbody";
									if (flag45)
									{
										num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Lowerbody);
										xitem = specificDocument8.EquipBag[num10];
									}
									else
									{
										bool flag46 = a == "mainweapon";
										if (flag46)
										{
											num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Mainweapon);
											xitem = specificDocument8.EquipBag[num10];
										}
										else
										{
											bool flag47 = a == "necklace";
											if (flag47)
											{
												num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Necklace);
												xitem = specificDocument8.EquipBag[num10];
											}
											else
											{
												bool flag48 = a == "rings";
												if (flag48)
												{
													num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Rings);
													xitem = specificDocument8.EquipBag[num10];
												}
												else
												{
													bool flag49 = a == "secondaryweapon";
													if (flag49)
													{
														num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Secondaryweapon);
														xitem = specificDocument8.EquipBag[num10];
													}
													else
													{
														bool flag50 = a == "upperbody";
														if (flag50)
														{
															num10 = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.Upperbody);
															xitem = specificDocument8.EquipBag[num10];
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
					bool flag51 = num9 == 0;
					if (flag51)
					{
						bool flag52 = xitem == null || xitem.itemID == 0;
						if (flag52)
						{
							flag = false;
						}
					}
					else
					{
						bool flag53 = !specificDocument9.HasRedPoint(num10);
						if (flag53)
						{
							flag = false;
						}
					}
					break;
				}
				case XTutorialCmdExecuteCondition.No_Stackui:
				{
					bool flag54 = XSingleton<UIManager>.singleton.IsUIShowed() || XSingleton<UIManager>.singleton.IsHideTutorial();
					if (flag54)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Activity_Open:
				{
					bool flag55 = !XSingleton<XTutorialHelper>.singleton.ActivityOpen;
					if (flag55)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Dragon_Crusade_Open:
				{
					bool flag56 = !XSingleton<XTutorialHelper>.singleton.DragonCrusadeOpen;
					if (flag56)
					{
						flag = false;
					}
					break;
				}
				case XTutorialCmdExecuteCondition.Battle_NPC_Talk_End:
				{
					bool flag57 = !XSingleton<XTutorialHelper>.singleton.BattleNPCTalkEnd;
					if (flag57)
					{
						flag = false;
					}
					break;
				}
				}
				bool flag58 = !flag;
				if (flag58)
				{
					break;
				}
			}
			return flag;
		}

		// Token: 0x0600C16F RID: 49519 RVA: 0x002943D0 File Offset: 0x002925D0
		public bool CanTutorialExecute(XTutorialMainCmd tutorial)
		{
			return this.ConditionSatisified(tutorial.conditions, tutorial.condParams);
		}

		// Token: 0x0600C170 RID: 49520 RVA: 0x002943F8 File Offset: 0x002925F8
		public bool CanCmdExecute(XTutorialCmd cmd)
		{
			bool flag = cmd.state == XCmdState.Cmd_In_Process || cmd.state == XCmdState.Cmd_Finished;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = this.ConditionSatisified(cmd.conditions, cmd.condParams);
				bool flag3 = flag2;
				if (flag3)
				{
					for (int i = 0; i < cmd.conditions.Count; i++)
					{
						XTutorialCmdExecuteCondition xtutorialCmdExecuteCondition = cmd.conditions[i];
						if (xtutorialCmdExecuteCondition != XTutorialCmdExecuteCondition.External_String)
						{
							if (xtutorialCmdExecuteCondition == XTutorialCmdExecuteCondition.Sys_Notify)
							{
								XSingleton<XTutorialMgr>.singleton.QueryExternalString("OpenSys" + cmd.condParams[i], true);
							}
						}
						else
						{
							XSingleton<XTutorialMgr>.singleton.QueryExternalString(cmd.condParams[i], true);
						}
					}
					result = true;
				}
				else
				{
					result = false;
				}
			}
			return result;
		}

		// Token: 0x0600C171 RID: 49521 RVA: 0x002944CC File Offset: 0x002926CC
		public bool CanCmdFinish(XTutorialCmd cmd)
		{
			bool flag = cmd.state != XCmdState.Cmd_In_Process;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = cmd.endcondition == XTutorialCmdFinishCondition.No_Condition;
				if (flag2)
				{
					result = false;
				}
				else
				{
					bool flag3 = false;
					switch (cmd.endcondition)
					{
					case XTutorialCmdFinishCondition.Time:
					{
						float time = Time.time;
						float num = (cmd.endParam.Count > 0) ? float.Parse(cmd.endParam[0]) : 3f;
						bool flag4 = time - this._command._startTime > num;
						if (flag4)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.TalkingNpc:
					{
						bool flag5 = DlgBase<DramaDlg, DramaDlgBehaviour>.singleton.IsVisible();
						if (flag5)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.WorldMap:
					{
						bool flag6 = DlgBase<DungeonSelect, DungeonSelectBehaviour>.singleton.IsVisible();
						if (flag6)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.SkillLevelup:
					{
						bool skillLevelup = XSingleton<XTutorialHelper>.singleton.SkillLevelup;
						if (skillLevelup)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.SkillBind:
					{
						bool skillBind = XSingleton<XTutorialHelper>.singleton.SkillBind;
						if (skillBind)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.UseItem:
					{
						bool useItem = XSingleton<XTutorialHelper>.singleton.UseItem;
						if (useItem)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.SysOpened:
					{
						XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
						bool flag7 = xplayerData.IsSystemOpened(uint.Parse(cmd.param1));
						if (flag7)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.GetReward:
					{
						bool getReward = XSingleton<XTutorialHelper>.singleton.GetReward;
						if (getReward)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.Move:
					{
						bool moved = XSingleton<XTutorialHelper>.singleton.Moved;
						if (moved)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.ComposeFashion:
					{
						bool fashionCompose = XSingleton<XTutorialHelper>.singleton.FashionCompose;
						if (fashionCompose)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.ReinforceItem:
					{
						bool reinforceItem = XSingleton<XTutorialHelper>.singleton.ReinforceItem;
						if (reinforceItem)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.EnhanceItem:
					{
						bool enhanceItem = XSingleton<XTutorialHelper>.singleton.EnhanceItem;
						if (enhanceItem)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.ChangeProf:
					{
						bool switchProf = XSingleton<XTutorialHelper>.singleton.SwitchProf;
						if (switchProf)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.HasTeam:
					{
						bool hasTeam = XSingleton<XTutorialHelper>.singleton.HasTeam;
						if (hasTeam)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.Smelting:
					{
						bool smelting = XSingleton<XTutorialHelper>.singleton.Smelting;
						if (smelting)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.SelectView:
					{
						bool selectView = XSingleton<XTutorialHelper>.singleton.SelectView;
						if (selectView)
						{
							flag3 = true;
						}
						break;
					}
					case XTutorialCmdFinishCondition.SelectSkipTutorial:
					{
						bool selectSkipTutorial = XSingleton<XTutorialHelper>.singleton.SelectSkipTutorial;
						if (selectSkipTutorial)
						{
							flag3 = true;
						}
						break;
					}
					}
					bool flag8 = flag3;
					result = flag8;
				}
			}
			return result;
		}

		// Token: 0x0600C172 RID: 49522 RVA: 0x00294784 File Offset: 0x00292984
		private bool IsSkip(XTutorialCmd cmd)
		{
			string skipCondition = cmd.skipCondition;
			bool flag = string.IsNullOrEmpty(skipCondition);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				XSkillTreeDocument specificDocument = XDocuments.GetSpecificDocument<XSkillTreeDocument>(XSkillTreeDocument.uuID);
				bool flag2 = false;
				string text = skipCondition;
				uint num = PrivateImplementationDetails.ComputeStringHash(text);
				if (num <= 2100011009U)
				{
					if (num <= 985216048U)
					{
						if (num != 153474289U)
						{
							if (num != 461464819U)
							{
								if (num == 985216048U)
								{
									if (text == "MenuBtnInState2")
									{
										flag2 = !DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.MenuSwitchBtnState;
									}
								}
							}
							else if (text == "ModalDlg")
							{
								flag2 = !DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.IsVisible();
							}
						}
						else if (text == "NoLearnSkill")
						{
							bool flag3 = cmd.skipParam2 == null || cmd.skipParam3 == null;
							if (flag3)
							{
								XSingleton<XDebug>.singleton.AddErrorLog(string.Concat(new object[]
								{
									"TutorialId:",
									cmd.TutorialID,
									" Error\ntag:",
									cmd.tag,
									" Command:LearnSkill  Param Num Error"
								}), null, null, null, null, null);
							}
							flag2 = specificDocument.isTutorialNeed(int.Parse(cmd.skipParam2), int.Parse(cmd.skipParam3));
						}
					}
					else if (num <= 2057789062U)
					{
						if (num != 1035548905U)
						{
							if (num == 2057789062U)
							{
								if (text == "LearnSkill")
								{
									bool flag4 = cmd.skipParam2 == null || cmd.skipParam3 == null;
									if (flag4)
									{
										XSingleton<XDebug>.singleton.AddErrorLog(string.Concat(new object[]
										{
											"TutorialId:",
											cmd.TutorialID,
											" Error\ntag:",
											cmd.tag,
											" Command:LearnSkill  Param Num Error"
										}), null, null, null, null, null);
									}
									flag2 = !specificDocument.isTutorialNeed(int.Parse(cmd.skipParam2), int.Parse(cmd.skipParam3));
								}
							}
						}
						else if (text == "MenuBtnInState1")
						{
							flag2 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.MenuSwitchBtnState;
						}
					}
					else if (num != 2090134647U)
					{
						if (num == 2100011009U)
						{
							if (text == "HasTaskTab")
							{
								flag2 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton._TaskNaviHandler._TaskSwitchBtnState;
							}
						}
					}
					else if (text == "SelectSight2.5D")
					{
						XOptionsDocument specificDocument2 = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
						flag2 = (specificDocument2.GetValue(XOptionsDefine.OD_VIEW) == XFastEnumIntEqualityComparer<XOperationMode>.ToInt(XOperationMode.X25D));
					}
				}
				else if (num <= 2995591070U)
				{
					if (num != 2352948218U)
					{
						if (num != 2805484350U)
						{
							if (num == 2995591070U)
							{
								if (text == "InTeamTab")
								{
									flag2 = !DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton._TaskNaviHandler.IsShowingTaskTab;
								}
							}
						}
						else if (text == "PPTLess")
						{
							bool flag5 = cmd.skipParam2 == null;
							if (flag5)
							{
								XSingleton<XDebug>.singleton.AddErrorLog(string.Concat(new object[]
								{
									"TutorialId:",
									cmd.TutorialID,
									" Error\ntag:",
									cmd.tag,
									" Command:PPTLess  Param Num Error"
								}), null, null, null, null, null);
							}
							flag2 = (XSingleton<XAttributeMgr>.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Total) < (double)int.Parse(cmd.skipParam2));
						}
					}
					else if (text == "InTaskTab")
					{
						flag2 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton._TaskNaviHandler.IsShowingTaskTab;
					}
				}
				else if (num <= 3972437787U)
				{
					if (num != 3566417125U)
					{
						if (num == 3972437787U)
						{
							if (text == "RadioNoCanOpen")
							{
								XRadioDocument specificDocument3 = XDocuments.GetSpecificDocument<XRadioDocument>(XRadioDocument.uuID);
								XOptionsDocument specificDocument4 = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
								flag2 = (specificDocument3.roomState == XRadioDocument.BigRoomState.InRoom || specificDocument4.GetValue(XOptionsDefine.OD_RADIO) == 0);
							}
						}
					}
					else if (text == "CurSkillNoLearn")
					{
						flag2 = !specificDocument.CheckLevelUpButton();
					}
				}
				else if (num != 4122175948U)
				{
					if (num == 4247367664U)
					{
						if (text == "Chapter1Star8Box")
						{
							flag2 = XSingleton<XStageProgress>.singleton.HasChapterBoxFetched(1, 0);
						}
					}
				}
				else if (text == "ProfessionNo1Turn")
				{
					flag2 = (XFastEnumIntEqualityComparer<RoleType>.ToInt(XSingleton<XAttributeMgr>.singleton.XPlayerData.Profession) < 10);
				}
				result = flag2;
			}
			return result;
		}

		// Token: 0x0600C173 RID: 49523 RVA: 0x00294C98 File Offset: 0x00292E98
		public void ResetRelativeFlag()
		{
			XSingleton<XTutorialHelper>.singleton.SkillLevelup = false;
			XSingleton<XTutorialHelper>.singleton.SkillBind = false;
			XSingleton<XTutorialHelper>.singleton.UseItem = false;
			XSingleton<XTutorialHelper>.singleton.GetReward = false;
			XSingleton<XTutorialHelper>.singleton.FashionCompose = false;
			XSingleton<XTutorialHelper>.singleton.ReinforceItem = false;
			XSingleton<XTutorialHelper>.singleton.EnhanceItem = false;
			XSingleton<XTutorialHelper>.singleton.SwitchProf = false;
			XSingleton<XTutorialHelper>.singleton.MeetEnemy = false;
			XSingleton<XTutorialHelper>.singleton.HasTeam = false;
			XSingleton<XTutorialHelper>.singleton.Smelting = false;
			XSingleton<XTutorialHelper>.singleton.HitDownOnGround = false;
		}

		// Token: 0x04005189 RID: 20873
		private XBaseCommand _command;

		// Token: 0x0400518A RID: 20874
		public float _lastCmdFinishTime = 0f;

		// Token: 0x0400518B RID: 20875
		private XCommandForceClick _forceCmd = new XCommandForceClick();

		// Token: 0x0400518C RID: 20876
		private XCommandCutscene _cutsceneCmd = new XCommandCutscene();

		// Token: 0x0400518D RID: 20877
		private XCommandExec _execCmd = new XCommandExec();

		// Token: 0x0400518E RID: 20878
		private XCommandForceSlide _forceSlideCmd = new XCommandForceSlide();

		// Token: 0x0400518F RID: 20879
		private XCommandGenericClick _genericClickCmd = new XCommandGenericClick();

		// Token: 0x04005190 RID: 20880
		private XCommandNewIcon _newIconCmd = new XCommandNewIcon();

		// Token: 0x04005191 RID: 20881
		private XCommandDirectSys _newDirectSys = new XCommandDirectSys();

		// Token: 0x04005192 RID: 20882
		private XCommandNoforceClick _noforceClickCmd = new XCommandNoforceClick();

		// Token: 0x04005193 RID: 20883
		private XCommandPureText _pureTextCmd = new XCommandPureText();

		// Token: 0x04005194 RID: 20884
		private XCommandMove _moveCmd = new XCommandMove();

		// Token: 0x04005195 RID: 20885
		private XCommandForceSkill _skillCmd = new XCommandForceSkill();

		// Token: 0x04005196 RID: 20886
		private XCommandPureOverlay _overlayCmd = new XCommandPureOverlay();

		// Token: 0x04005197 RID: 20887
		private XCommandPrefab _prefabCmd = new XCommandPrefab();

		// Token: 0x04005198 RID: 20888
		private XCommandNote _noteCmd = new XCommandNote();

		// Token: 0x04005199 RID: 20889
		private XCommandHideSkills _hideskillCmd = new XCommandHideSkills();

		// Token: 0x0400519A RID: 20890
		private XCommandShowSkills _showskillCmd = new XCommandShowSkills();

		// Token: 0x0400519B RID: 20891
		private XCommandIsShowButton _isshowbuttonCmd = new XCommandIsShowButton();

		// Token: 0x0400519C RID: 20892
		private XCommandClickEntity _clickEntityCmd = new XCommandClickEntity();

		// Token: 0x0400519D RID: 20893
		private XCommandEmpty _emptyCmd = new XCommandEmpty();
	}
}
